/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.subsystems.ArmSubsystem.PresetArmPosition;
import edu.wpi.first.wpilibj.templates.subsystems.DaisyWristSubsystem;
import edu.wpi.first.wpilibj.templates.subsystems.DaisyWristSubsystem.PresetWristPosition;

/**
 *
 * @author Jarrod Risley
 */
public class SetArmPosition extends CommandBase {
    
    /*
     * Global Class Variables
     */
    private PresetArmPosition commandedPosition;
    private boolean isFinished = false;
    
    public SetArmPosition(PresetArmPosition position) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        
        requires(mainArm);
        requires(intake);
        commandedPosition = position;
        
    } // end SetArmPosition

    // Called just before this Command runs the first time
    protected void initialize() {
        
        if (mainArm.areMotorsEnabled())
            end();
        
        System.out.println("Setting Main Arm position to " + commandedPosition.getValue());
        mainArm.setPosition(commandedPosition);
        
    } // end intialize

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        
        System.out.println("Current Arm Position: " + mainArm.getLocation());
        
    } // end execute

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    } // end isFinished

    // Called once after isFinished returns true
    protected void end() {
        
        mainArm.initDefaultCommand();
        
    } // end end...lolz

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
        end();
    } // end interrupted
    
} // end SetArmPosition
